<!DOCTYPE html>
<title>Test that removing a media element from the tree while loading does not crash.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../../media-resources/media-file.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.onloadedmetadata = t.step_func(function() {
        document.body.removeChild(video);
        setTimeout(t.step_func_done(), 100);
    });

    var mediaFile = "content/test.ogv";
    var mimeType = mimeTypeForFile(mediaFile);
    video.src = "http://127.0.0.1:8000/resources/load-and-stall.php?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=100000";
});
</script>